package BNS.kingPawn;

import java.util.*;
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
import java.rmi.*;
import javax.swing.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
import BNS.graphs.*;
import BNS.plumbing.*;

/** The specialization of the MarketISPersona for the KingPawnGame.
	Somewhat unexpectedly, this class has LESS functionality than MarketISPersona:
	it does not have the tipping elements in the control panel, and thus all tips
	are zero at all times. Otherwise, the behaviour is identical.
	*/
public class KingPawnPersona extends MarketISPersona {
	
	/** This constructor just calls its superclass's constructor, with all
		the same parameters. It is intended to be called on the *server machine*,
		so that the 5 arguments here are stored in it and the resulting object is 
		later passed to the client where further setup is performed.
		*/
	public KingPawnPersona(ClientLiaison g, Graph gr, int ssize, int time, int progress) { 
		// TODO: is this formally necessary? Can it be removed without effect?
		super(g, gr, ssize, time, progress);
		}
	
	/** This method must be called after the constructor and before any use of the object.
		It is separated from the constructor because it contains a lot of constructions that
		should not be performed until the object has arrived on the *client machine*.
		For instance, the construction of the GUI elements such as JPanels should not be
		performed on the server. Herein, all the GUI elements are finally built, assembled,
		and made visible.
		*/
	public JComponent startPanel() {
		tip= new float[superSize];
		numNodes= graphlet.numNodes(); 
		panel= new JPanel();
		panel.setLayout(new BorderLayout());
		panel.setBackground(panelBackground);
		panel.setOpaque(true);
		
		statusPanel= new StatusPanel(timeLimit,progressLimit,false);
		panel.add("North", statusPanel);
		statusPanel.setMaximumSize(new Dimension(450,400));	// ANY limit seems to tame this
		
		graphPanel= new ShowNodeTipsPanel(ColorMap.identity());
		graphPanel.setDisplayNodes(true);
		panel.add("Center",graphPanel);
		graphPanel.init(graphlet);
		
		controlPanel= new ControlPanel(this,false);
		controlPanel.setOpaque(true);
		controlPanel.setBackground(panelBackground);
		panel.add("South", controlPanel);
		
		return panel;
		}
	
	/** identifies the type of game. */
	public String getTitle() { return "KingPawnPersona"; }
	
	} // EOC KingPawnPersona
